"""
    _    _  _        _                 _
  _| |_ (_)| | __  _| |_   ___   ___  | | ___
 |_  __|| || |/ / |_  __| / _ \ / _ \ | |/ __|
   | |_ | ||   <    | |_ | (_) | (_) || |\__ \
    \__||_||_|\_\    \__| \___/ \___/ |_||___/

"""
import numpy as np
from tools.init import tiktools
from tools.precision_compare import data_compare
tiktools.yes_list = ["OP Type", "Task Duration(us)", "Block Dim", "aiv_time(us)"]
# tiktools.run_profiling_mode = "on"

def run_op():
    inputs_info = [{"shape": [2, 3, 4], "dtype": "float16", "format": "ND"},
                   {"shape": [2, 3, 4], "dtype": "float16", "format": "ND"}]
    outputs_info = [{"shape": [2, 3, 4], "dtype": "float16", "format": "ND"}]
    attr_dict = {}

    result = tiktools.run("Add", inputs_info, [x1, x2], outputs_info, attr_dict, device_id=0)
    return result

def run_golden():
    res = x1 + x2
    return res

if __name__ == "__main__":
    x1 = np.random.uniform(-5, 5, [2, 3, 4]).astype(np.float16)
    x2 = np.random.uniform(-5, 5, [2, 3, 4]).astype(np.float16)

    npu_out = run_op()
    cpu_out = run_golden()
    data_compare(npu_out, cpu_out, 0.0001, 0.0001)
